package com.toe.recommend.webapi.controller;


import com.toe.common.restful.JsonResult;
import com.toe.pojo.vo.recommend.RecommendCommodityVO;
import com.toe.recommend.service.RecommendCommodityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 陶涛
 * @since 2022-07-19
 */
@RestController
@RequestMapping("/recommend-commodity")
@Api(tags = "推荐商品模块")
public class RecommendCommodityController {

    @Autowired
    RecommendCommodityService recommendCommodityService;

    @GetMapping("/{userId}/{count}")
    @ApiOperation("推荐商品")
    @ApiImplicitParam(value = "用户id", name = "userId",
            required = true, dataType = "long", example = "1")
    public JsonResult<List<RecommendCommodityVO>> recommendCommodity(
            @PathVariable("userId") Long userId,
            @PathVariable("count") int count) {
        return JsonResult.ok(recommendCommodityService.recommendCommodity(userId, count));
    }

}

